.TH std::experimental::basic_string_view 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::basic_string_view \- std::experimental::basic_string_view

.SH Synopsis
   Defined in header <experimental/string_view>
   template<

       class CharT,                              (library fundamentals TS)
       class Traits = std::char_traits<CharT>

   > class basic_string_view;

   The class template basic_string_view describes an object that can refer to a
   constant contiguous sequence of char-like objects with the first element of the
   sequence at position zero.

   A typical implementation holds only two members: a pointer to constant CharT and a
   size.

   Several typedefs for common character types are provided:

   Defined in header <experimental/string_view>
   Type                              Definition
   std::experimental::string_view    std::experimental::basic_string_view<char>
   std::experimental::wstring_view   std::experimental::basic_string_view<wchar_t>
   std::experimental::u16string_view std::experimental::basic_string_view<char16_t>
   std::experimental::u32string_view std::experimental::basic_string_view<char32_t>

.SH Template parameters

   CharT  - character type
   Traits - traits class specifying the operations on the character type

.SH Member types

   Member type            Definition
   traits_type            Traits
   value_type             CharT
   pointer                CharT*
   const_pointer          const CharT*
   reference              CharT&
   const_reference        const CharT&
   const_iterator         implementation-defined LegacyRandomAccessIterator
   iterator               const_iterator
   reverse_iterator       const_reverse_iterator
   const_reverse_iterator std::reverse_iterator<const_iterator>
   size_type              std::size_t
   difference_type        std::ptrdiff_t

   Note: iterator and const_iterator are the same type because string views are views
   into constant character sequences.

.SH Member functions

   constructor           constructs a basic_string_view
                         \fI(public member function)\fP
   operator=             assigns a view
                         \fI(public member function)\fP
.SH Iterators
   begin                 returns an iterator to the beginning
   cbegin                \fI(public member function)\fP
   end                   returns an iterator to the end
   cend                  \fI(public member function)\fP
   rbegin                returns a reverse iterator to the beginning
   crbegin               \fI(public member function)\fP
   rend                  returns a reverse iterator to the end
   crend                 \fI(public member function)\fP
.SH Element access
   operator[]            access specified character
                         \fI(public member function)\fP
   at                    access specified character with bounds checking
                         \fI(public member function)\fP
   front                 accesses the first character
                         \fI(public member function)\fP
   back                  accesses the last character
                         \fI(public member function)\fP
   data                  returns a pointer to the first character of a view
                         \fI(public member function)\fP
.SH Capacity
   size                  returns the number of characters
   length                \fI(public member function)\fP
   max_size              returns the maximum number of characters
                         \fI(public member function)\fP
   empty                 checks whether the view is empty
                         \fI(public member function)\fP
.SH Modifiers
   remove_prefix         shrinks the view by moving its start forward
                         \fI(public member function)\fP
   remove_suffix         shrinks the view by moving its end backward
                         \fI(public member function)\fP
   swap                  swaps the contents
                         \fI(public member function)\fP
.SH Operations
   to_string             creates a string from the view
   operator basic_string \fI(public member function)\fP
   copy                  copies characters
                         \fI(public member function)\fP
   substr                returns a substring
                         \fI(public member function)\fP
   compare               compares two views
                         \fI(public member function)\fP
   find                  find characters in the view
                         \fI(public member function)\fP
   rfind                 find the last occurrence of a substring
                         \fI(public member function)\fP
   find_first_of         find first occurrence of characters
                         \fI(public member function)\fP
   find_last_of          find last occurrence of characters
                         \fI(public member function)\fP
   find_first_not_of     find first absence of characters
                         \fI(public member function)\fP
   find_last_not_of      find last absence of characters
                         \fI(public member function)\fP
.SH Constants
   npos                  special value. The exact meaning depends on the context
   \fB[static]\fP              \fI(public static member constant)\fP

.SH Non-member functions

   operator==
   operator!=
   operator<  lexicographically compares two views
   operator>  \fI(function template)\fP
   operator<=
   operator>=
.SH Input/output
   operator<< performs stream output on views
              \fI(function template)\fP

.SH Helper classes

   std::hash<std::experimental::string_view>
   std::hash<std::experimental::wstring_view>   hash support for views
   std::hash<std::experimental::u16string_view> \fI(class template specialization)\fP
   std::hash<std::experimental::u32string_view>

   Feature test macros

                                      a value of at least 201411 indicates that
   __cpp_lib_experimental_string_view basic_string_view template is supported
                                      (macro constant)

.SH Category:
     * Noindexed pages
